"""
@Project:p9_exe
@File:asgi.py
@Author:郑凯乐
@Date:18:54
"""
import os
import chat.routing

from channels.routing import ProtocolTypeRouter,URLRouter
from channels.auth import AuthMiddlewareStack
from channels.security.websocket import AllowedHostsOriginValidator
# from django.core.asgi import get_asgi_application

os.environ.setdefault('DJANGO_SETTINGS_MODULE', 'takeawaydjango.settings')

# application = get_asgi_application()
# django_asgi_app = get_asgi_application()

application = ProtocolTypeRouter({
    # 'http':django_asgi_app,
    'websocket':AllowedHostsOriginValidator(
        AuthMiddlewareStack(
            URLRouter(
                chat.routing.websocket_urlpatterns
            )
        )
    )
})
